﻿Public Class frmTabMetadataInformation
    Dim editNode As EditXML = New EditXML()
    Dim dateConverter As ConvertDate = New ConvertDate()
    Public Shared objMRcontact As ContactInfo = New ContactInfo()
    Public Shared sPdelim As String = "£"

    Private Sub frmTabMetadataInformation_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Leave
        editXMLFile()
    End Sub
    Public Sub editXMLFile()
        editNode.Edit("/metadata/metainfo/metd", dateConverter.Convert2String(dtPick1.Value))
        editNode.Edit("/metadata/metainfo/metrd", dateConverter.Convert2String(dtPick2.Value))
        editNode.Edit("/metadata/metainfo/metfrd", dateConverter.Convert2String(dtPick3.Value))
        editNode.Edit("/metadata/metainfo/metstdn", cboxStdName.SelectedItem)
        editNode.Edit("/metadata/metainfo/metstdv", cboxStdVer.SelectedItem)
        editNode.Remove("/metadata/metainfo", "metc")
        editNode.Add("/metadata/metainfo", "metc", "metc", editNode.createContactInfo(objMRcontact))
    End Sub
    Private Sub btnMRedit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMRedit.Click
        Dim iConType As Integer = 0
        Dim frmMRcontact As frmContact
        If (txtMRcontact.Text = "") Then
            frmMRcontact = New frmContact(objMRcontact, 1)
        Else
            frmMRcontact = New frmContact(objMRcontact, 2)
        End If
        frmMRcontact.ShowDialog()
        If (frmMRcontact.getUpdated() = True) Then
            objMRcontact = frmMRcontact.getConInfo() 'update the contact object
            If (objMRcontact.PrimaryPerson = True) Then 'update the form display
                txtMRcontact.Text = objMRcontact.Person
            Else
                txtMRcontact.Text = objMRcontact.Organization
            End If
        End If
    End Sub

    Private Sub chkRevDate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRevDate.CheckedChanged
        If (chkRevDate.Checked = True) Then dtPick2.Enabled = True Else dtPick2.Enabled = False
    End Sub

    Private Sub chkFRevDate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkFRevDate.CheckedChanged
        If (chkFRevDate.Checked = True) Then dtPick3.Enabled = True Else dtPick3.Enabled = False
    End Sub

    Private Sub frmTabMetadataInformation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dtPick1.Value = DateTime.Now()
        dtPick2.Value = DateTime.Now()
        dtPick3.Value = DateTime.Now()
    End Sub

    Private Sub button_example_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_example.Click
        Dim helpForm As dialog_help = New dialog_help("MetadataInformation")
        helpForm.ShowDialog()
    End Sub

    Private Sub dtPick1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtPick1.ValueChanged
        dtPick2.MinDate() = dtPick1.Value
        dtPick3.MinDate() = dtPick2.Value
    End Sub

    Private Sub dtPick2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtPick2.ValueChanged
        dtPick3.MinDate() = dtPick2.Value
    End Sub
End Class